/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MessageHandler;

import Core.MessageBuilder;
import org.openymsg.network.Session;

/**
 *
 * @author Mr Bao
 */
public class ChangeStatusMessageHandler implements IMessageHandler {

    public Object Process(String message, Session session) {
        try {
            int index = message.indexOf(MessageBuilder.ONE);
            String tmp = message.substring(index + 1);
            String[] content = tmp.split(MessageBuilder.TWO);
            String newStatus = content[0];
            boolean showBusyIcon = Boolean.parseBoolean(content[1]);
            session.setStatus(newStatus, showBusyIcon);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
